home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
byt0187b.arc
/
RGNMAKER.ASM
< prev
next >
Wrap
Assembly Source File
|
1980-01-01
|
22KB
|
1,102 lines
; RgnMaker.ASM Sun 23 Feb '86 h. katz
; Tue 22 July
XREF DoContour ; source in < Traverse.ASM >
XREF Save_To_File, PutFile_Posit ; source in < SaveRgn.ASM >
XREF Have_Prior_DITLs, ItemHit
XDEF GetFirstPixel, FormingRgn, StartCoords, Trav_Count, MyRowBytes
XDEF IsRegion, CreateMenu, WMgrPort, ScratchSTR, PenPoint, WStorage
XDEF Save_Image, Restore_Image, Stop_Alert, RgnHandle, UnHiLite
INCLUDE QuickEqu.D
; portRect equ 16 ; offset in Window Record
; Bounds equ 6 ; offsets into BitMap
; rowBytes equ 4
; Top equ 0 ; offsets into portRect & Bounds
; Left equ 2
; Bottom equ 4
; Right equ 6
StringToNum equ 1 ; selector for _Pack7
scratch8 equ $9FA
scratch20 equ $1E4
ScreenBase equ $824
ScrapSize equ $960 ; ( word ) size in bytes
ScrapHandle equ $964
ScrapCount equ $968 ; ( word ) current counter value
ScrapState equ $96A ; ( word ) + = on disk
; 0 = in mem / - = not inited
ScrapName equ $96C ; StringPtr
CmdKey equ 8 ; BitNum in Event Modifier Record
PutFile_ID equ -3999 ; ResID for SFPutFile Dialog
WindID equ 100
AppleMenu equ 1
FileRgnMenu equ 2
WriteRgn_Item equ 1
Quit_Item equ 3
EditRgnMenu equ 3
CutItem equ 3
CopyItem equ 4
PasteItem equ 5
CreateRgnMenu equ 4
BuildRgnItem equ 1
DontBuildItem equ 2
CopyRegionItem equ 4
AddItem equ 5
SubtractItem equ 6
DisplayRgnMenu equ 5
LastMenu equ 5
FirstDACNum equ 3
HiBitNum equ 7 ; working with bytes
MouseDownEvent equ 1
KeyDownEvent equ 3
Traverse_Cursor equ 10 ; ResNum of my cursor
INCLUDE MacTraps.D
st FormingRgn(a5) ; turn off if we don't want to
; collect _Line's into a RgnDef
sf DeskAcc_Opened(a5)
sf Have_Pasted(a5)
st First_Activate(a5)
sf DoneFlag(a5)
sf IsRegion(a5) ; We've not done a Traverse with
; 'Form Region' On
sf DoneCopyRegion(a5) ; We've not copied a Region Traverse
; to the Work Area
sf Have_Prior_DITLs(a5) ; no prior saving of DITLs
move.l #0, BitMap(a5) ; haven't done a CopyBits yet
BSR InitManagers
BSR Save_WMgrPort
BSR Install_Menus
BSR OpenWindow
EventLoop
_SystemTask
tst.b Have_Pasted(a5) ; if we haven't Pasted,
beq @1 ; leave the cursor alone
clr.l -(sp)
_FrontWindow ; which window is frontmost ?
move.l (sp)+, a0
lea WStorage, a2 ; get Ptr to the Contour Window
cmpa.l a0, a2
beq.s @Check_pRect ; Contour Window is in front
bra.s @1 ; some other window is in front
@Check_pRect
clr -(sp) ; space for Boolean Func Result
pea MouseLoc
_GetMouse ; where's the cursor ?
move.l MouseLoc, -(sp)
pea portRect(a2)
_PtInRect
tst (sp)+
beq.s @1 ; NOT in contentRgn of Contour Window
bsr Set_Traverse_Cursor
bra.s @2
@1 _InitCursor
@2 bsr GetNextEvent
tst.b DoneFlag(a5)
beq.s EventLoop
_ExitToShell
Set_Traverse_Cursor
clr.l -(sp) ; reserve space for Handle
move #Traverse_Cursor, -(sp) ; Cursor ID
_GetCursor
move.l (sp)+, a0
move.l (a0), a0 ; ptr to CursorData
move.l a0, -(sp)
_SetCursor
RTS
GetNextEvent
subq.l #2, sp
move #-1, -(sp) ; eventMask = everyEvent
pea EventRecord
_GetNextEvent
tst.b (sp)+
beq.s Return
move What, D0
beq.s Return
cmp #9, d0 ; don't worry about events
bge.s Return ; numbered 9 or higher
add d0, d0
lea EventJTable, a0
add 0(a0, d0), a0
jmp(a0) ; we RTS out of each routine
; to EventLoop
EventJTable
@NullEvent dc Return - EventJTable ; 0
@MDown dc MouseDown - EventJTable ; 1
@MouseUp dc Return - EventJTable ; 2
@KDown dc KeyDown - EventJTable ; 3
@KeyUp dc Return - EventJTable ; 4
@AutoKey dc Return - EventJTable ; 5
@Update dc Return - EventJTable ; 6
@Disk dc Return - EventJTable ; 7
@Activate dc Activate - EventJTable ; 8
@Undefined dc Return - EventJTable ; 9
Activate
; check if the Contour Window is coming active. If it is,
; and this is the first time here, try Pasting in from the Scrap.
; else check if a Desk Accessory was open just prior. If it was,
; restore the saved background
clr.l -(sp)
_FrontWindow ; which window is frontmost ?
move.l (sp)+, a0
lea WStorage, a2 ; get Ptr to the Contour Window
cmpa.l a0, a2
bne.s @Rts ; Contour Window
@0 tst.b First_Activate(a5) ; do an 'auto-Paste' on 1st Activate
beq.s @1 ; no
sf First_Activate(a5) ; yes
BRA Paste_From_Clip
@1 tst.b DeskAcc_Opened(a5) ; was User using the ScrapBook ?
beq.s @Rts ; no
sf DeskAcc_Opened(a5) ; yes - turn off flag
BSR Restore_Image ; restore old background
@Rts RTS
MouseDown
clr -(sp) ; returns where Mouse was clicked
move.l Where, -(sp) ; global coords of Mouse Location
pea WhichWindow ; whose ?
_FindWindow
move (sp)+, d0 ; where was it
add d0, d0
lea MouseJTable, a0
add 0(a0, d0), a0
jmp(a0)
Return
RTS ; return to EventLoop
MouseJTable
@inDesk dc Return - MouseJTable
@inMBar dc InMenu - MouseJTable
@SysEvent dc SystemEvent - MouseJTable
@Content dc InContent - MouseJTable
@Drag dc Return - MouseJTable
@Grow dc Return - MouseJTable
@GoAway dc TrackGoAway - MouseJTable
Save_Image
; first get the intersection of the current port and the
; incoming Dialog or Alert in Global Coords.
; ResID of Resource in D3 / ResType in A3
lea WStorage+portRect, a0
lea Scratch20, a2
move.l (a0)+, (a2)+ ; move Window pRect into 1st 8
move.l (a0), (a2)+ ; bytes of Scratch20 area
pea Scratch20
_LocalToGlobal
pea Scratch20+4
_LocalToGlobal
clr.l -(sp) ; returned Handle
move.l a3, -(sp) ; 'DLOG' or 'ALRT'
move d3, -(sp) ; DLOG or ALRT ResID
_GetResource
move.l (sp)+, d1 ; Handle
BEQ @ErrRts
@1 move.l d1, a0
move.l (a0), a0 ; Ptr to Data
move.l (a0)+, (a2)+ ; move pRect of DLOG into 2nd 8 bytes
move.l (a0), (a2) ; of Scratch20 area
cmp #PutFile_ID, d3
bne.s @2
; SFPutFile DLOG requires an adjustment for PutFile_Posit
pea Scratch20+8
move.l PutFile_Posit, -(sp) ; Global TopLeft of DLOG pRect
_OffsetRect
@2 pea Scratch20+8 ; compensate for Window Frame
move #-8, -(sp) ; around the DLOG/ALRT pRect
move #-8, -(sp)
_InsetRect
clr -(sp) ; BOOLEAN result
pea Scratch20 ; Contour Window ( Global )
pea Scratch20+8 ; Dialog ( Global )
pea Scratch20+8 ; => Intersection ( Global )
_SectRect
tst (sp)+
BEQ @ErrRts
pea Scratch20+8
_GlobalToLocal
pea Scratch20+8+4
_GlobalToLocal
lea BitMap(a5), a3
move.l Scratch20+8, Bounds(a3)
move.l Scratch20+12, Bounds+4(a3)
BSR Get_Size ; returns D0 = Size ( bytes )
; D1 = rowBytes
move d1, rowBytes(a3)
_NewHandle,CLEAR
BMI @ErrRts
move.l a0, Image_Handle(a5)
move.l (a0), (a3) ; deref to Ptr = BaseAddr
; in ToBitMap
move.l (a5), a2 ; QDVars
move.l (a2), a2
lea 2(a2), a2
move.l a2, -(sp) ; fromBitMap
move.l a3, -(sp) ; toBitMap
pea Scratch20+8 ; local coords of fromRect
move.l (sp), -(sp) ; again for ToRect
move #0, -(sp) ; mode
clr.l -(sp) ; maskRgn = NIL
_CopyBits
BRA @Rts
@ErrRts move.l #0, BitMap(a5) ; can't save the image - forget it
@Rts RTS
Restore_Image
pea WStorage
_BeginUpdate
tst.l BitMap(a5) ; have we done a 'Save_Image' CopyBits ?
beq.s @End ; no
lea BitMap(a5), a2
move.l Image_Handle(a5), a0
move.l (a0), (a2) ; baseAddr
move.l a2, -(sp) ; fromBitMap
move.l (a5), a3
move.l (a3), a3
pea 2(a3) ; toBitMap ( the screen )
pea Bounds(a2)
move.l (sp), -(sp) ; again for ToRect
move #0, -(sp) ; mode
clr.l -(sp) ; maskRgn = NIL
_CopyBits
move.l #0, BitMap(a5) ; clear CopyBits 'flag'
move.l Image_Handle(a5), a0
_DisposHandle ; clear up space on the Heap
@End pea WStorage
_EndUpdate
RTS
Get_Size
move Bounds+Right(a3), d2
ext.l d2
sub Bounds+Left(a3), d2 ; width
add #1, d2
divu #16, d2 ; => remainder + quotient
move d2, d1 ; save quotient
and.l #$FFFF0000, d2 ; check remainder
beq.s @1 ; no remainder
add #1, d1 ; rowWords
@1 add d1, d1 ; words -> bytes
move Bounds+Bottom(a3), d0
sub Bounds+Top(a3), d0
add #1, d0
; d1 => rowBytes
mulu d1, d0 ; d0 => Size ( long ) for _NewHandle
RTS
TrackGoAway
clr -(sp) ; space for BOOLEAN result
pea WStorage
move.l Where, -(sp) ; from Event Record
_TrackGoAway
move (sp)+, d0
bne SetDone ; mouse WAS released in goAway box
RTS ; it wasn't
InMenu
clr.l -(sp)
move.l Where, -(sp) ; global again
_MenuSelect ; track the mouse in the MBar
move.l (sp)+, d0 ; save Menu and ItemNum
swap d0 ; MenuNum -> LowByte
FindMenu
cmp #AppleMenu, d0
BEQ In_Apple_Menu
cmp #FileRgnMenu, d0
BEQ In_File_Menu
cmp #EditRgnMenu, d0
BEQ In_Edit_Menu
cmp #CreateRgnMenu, d0
BEQ In_CreateRgn_Menu
cmp #DisplayRgnMenu, d0
BEQ In_DisplayRgn_Menu
BRA UnHiLite
In_Apple_Menu
swap d0 ; ItemNum back in Low Byte
cmp #1, d0
bne @GetDAC ; not Item 1 - must be Open a Desk Acc
move #107, d3 ; ResID of upcoming 'About' DLOG
move.l #'DLOG', a3
BSR Save_Image
clr.l -(sp) ; reserve space for Ptr
move #106, -(sp) ; 'About' DLOG ID
move.l #0, -(sp) ; create space
move.l #-1, -(sp) ; in front of everything
_GetNewDialog
move.l (sp)+, d4
BSR @Wait_for_next
move.l d4, -(sp)
_CloseDialog
clr.l -(sp) ; reserve space for Ptr
move #107, -(sp) ; 'About' DLOG Instructions ID
move.l #0, -(sp) ; create space
move.l #-1, -(sp) ; in front of everything
_GetNewDialog
move.l (sp)+, d4
BSR @Wait_for_next
move.l d4, -(sp)
_CloseDialog
clr.l -(sp) ; reserve space for Ptr
move #108, -(sp) ; 'About' DLOG Instructions Part2 ID
move.l #0, -(sp) ; create space
move.l #-1, -(sp) ; in front of everything
_GetNewDialog
move.l (sp)+, d4
BSR @Wait_for_next
move.l d4, -(sp)
_CloseDialog
BSR Restore_Image
bra.s UnHiLite
@Wait_for_next
move.l #0, -(sp) ; no filterProc
pea ItemHit
_ModalDialog
move ItemHit, d0
cmp #1, d0
bne @Wait_for_next
RTS
@GetDAC
move.l HAppleMenu(a5), -(sp) ; saved menuHandle for AppleMenu
move d0, -(sp)
pea DACName
_GetItem
st DeskAcc_Opened(a5)
move #WindID, d3 ; ResID of upcoming Dialog/Alert
move.l #'WIND', a3
BSR Save_Image ; save Bits to be hidden by the DeskAcc
clr -(sp)
pea DACName
_OpenDeskAcc
move (sp)+, d0
pea WStorage
_SetPort
UnHiLite
clr -(sp)
_HiLiteMenu
RTS
In_File_Menu
swap D0
cmp #Quit_Item, D0
BEQ SetDone
cmp #WriteRgn_Item, d0
bne UnHiLite
BSR Save_To_File ; see source in < SaveRgn.ASM >
bra UnHiLite
In_Edit_Menu
swap d0 ; Put ItemNum in Low Byte
move d0, d3
BSR System_Edit
BNE.s @Bra ; Desk Acc handled the Menu selection
move d3, d0 ; restore MenuID & ItemNum
cmp #CutItem, d0
BEQ.s @Cut
cmp #CopyItem, d0
BEQ.s @Copy
cmp #PasteItem, d0
BNE.s @Bra
; do a Paste
BRA Paste_From_Clip
@Cut
BRA @Bra
@Copy
@Bra BRA UnHiLite
System_Edit
sub #1, d0 ; check if the Desk Accessory is
clr -(sp) ; going to handle our Edit selection
move d0, -(sp)
_SysEdit
move (sp)+, d0 ; pop the result
RTS ; ( FALSE = WE handle it )
In_DisplayRgn_Menu
swap d0
cmp #1, d0 ; Clear Window ?
beq.s @clear
tst.b DoneCopyRegion(a5) ; Don't Allow Region Operations if
BEQ @bra1 ; we haven't copied one to Work Area
cmp #3, d0 ; Frame Region ?
beq.s @Frame
cmp #4, d0 ; Paint Region ?
beq.s @Paint
cmp #5, d0 ; Invert Region ?
beq.s @Invert
cmp #7, d0
beq.s @DrawSize
BRA @Bra1
@Frame move.l RgnHandle(a5), -(sp)
_FrameRgn
bra.s @Bra1
@Paint move.l RgnHandle(a5), -(sp)
_PaintRgn
bra.s @Bra1
@Invert move.l RgnHandle(a5), -(sp)
_InverRgn
bra.s @Bra1
@clear move.l (a5), a0
move.l (a0), a0
pea 16(a0)
_EraseRect
bra.s @Bra1
@DrawSize
move.l WMgrPort, -(sp)
_SetPort
move.l PenPoint, -(sp)
_MoveTo
pea ' '
_DrawString
move.l RgnHandle(a5), a0 ; Handle
move.l (a0), a0 ; Pointer to ( Addr of ) Region
move (a0), d0 ; RgnSize ( INT )
ext.l d0
lea ScratchSTR, a0
move #0, -(sp) ; Num to String
_Pack7
pea ScratchSTR
_DrawString
pea ' Bytes'
_DrawString
pea WStorage
_SetPort
@bra1 BRA UnHiLite
SetDone
st DoneFlag(a5)
RTS
In_CreateRgn_Menu
swap D0
move D0, D3 ; Save Selected Item Number
cmp #DontBuildItem, d0
bhi @2 ; Was it 'Copy' or greater ?
; User Selected either 'Build Region' or 'Display Only'
move.l CreateMenu(A5), -(sp) ; UnCheck Both Items 1 & 2
move #1, -(sp)
sf -(sp)
_CheckItem
move.l CreateMenu(A5), -(sp)
move #2, -(sp)
sf -(sp)
_CheckItem
move.l CreateMenu(A5), -(sp) ; and Check the Apt Item
move d3, -(sp)
st -(sp)
_CheckItem
cmp #DontBuildItem, d3
bne.s @1 ; We're ARE Forming a Region
sf FormingRgn(A5) ; We're NOT Forming a Region
BRA @Bra
@1 st FormingRgn(A5)
BRA @Bra
; User Selected either 'Copy to', 'Add to', or 'Subtract from Work Area'
@2 tst.b IsRegion(a5)
BEQ @Bra ; We haven't Formed a Region yet
cmp #CopyRegionItem, d3
beq.s @CopyToWorkArea
tst.b DoneCopyRegion(a5)
BEQ @Bra ; We can't Add or Subtract from the
; Work Area until we've done a 'Copy'
cmp #AddItem, d3
beq.s @AddToWorkArea
cmp #SubtractItem, d3
beq.s @SubtractFromWorkArea
BRA @Bra
@CopyToWorkArea
tst.b DoneCopyRegion(a5) ; have we previously done a 'Copy' ?
beq.s @3 ; no
move.l RgnHandle(a5), -(sp) ; we don't want old Regions cluttering
_DisposRgn ; up the Heap
@3 move.l a6, -(sp) ; Handle to Current (traverse) Region
clr.l -(sp)
_NewRgn
move.l (sp), RgnHandle(a5)
_CopyRgn
st DoneCopyRegion(a5) ; use this flag to allow
; later Add & Subtract
move.l FileMenu(A5), -(sp)
move #WriteRgn_Item, -(sp)
_EnableItem
move.l CreateMenu(A5), -(sp)
move.l (sp), -(sp)
move #AddItem, -(sp) ; And allow these 2 selections
_EnableItem
move #SubtractItem, -(sp)
_EnableItem
move.l DisplayMenu(A5), -(sp)
move.l (sp), -(sp)
move.l (sp), -(sp)
move.l (sp), -(sp)
move #3, -(sp) ; Frame Region
_EnableItem
move #4, -(sp) ; Paint Region
_EnableItem
move #5, -(sp) ; Invert Region
_EnableItem
move #7, -(sp) ; Draw Region Size
_EnableItem
BRA @Bra
@AddToWorkArea
move.l a6, -(sp) ; SourceA = Current (traverse) Region
move.l RgnHandle(a5), -(sp) ; SourceB = Destination (Work Area) Rgn
move.l RgnHandle(a5), -(sp) ; Destination = Work Area
_UnionRgn
BRA.s @Bra
@SubtractFromWorkArea
move.l RgnHandle(a5), -(sp) ; Region B
move.l a6, -(sp) ; - Region A
move.l RgnHandle(a5), -(sp)
_DiffRgn
@Bra BRA UnHiLite
SystemEvent
pea EventRecord
move.l WhichWindow, -(sp)
_SystemClick
RTS
InContent
tst.b Have_Pasted(a5) ; have we got anything to traverse ?
beq Return ; no
bra DoContour ; ( returns from DoContour to EventLoop )
KeyDown
; check to see if the Command Key was down
; if so, see it it's a menu-item equivalent
; else ignore it
move Modifiers, d3
btst #CmdKey, d3
bNE @GetCmdKey
RTS
@GetCmdKey
clr.l -(sp)
move Message+2, -(sp) ; get the character
_MenuKey
move.l (sp)+, d0
swap d0 ; put MenuID in Low Byte
BRA FindMenu
Paste_From_Clip
; check the scrap. if there's no PICT there, just
; beep and return for now. else frame it in the window
move.l ScrapHandle, d0
beq @8 ; Beep no Scrap
; we've got a 'PICT' on the Clipboard
move.l #0, d0
_NewHandle
bmi ErrReturn
move.l a0, a2 ; save the handle
clr.l -(sp)
move.l a2, -(sp) ; destination handle for incoming
move.l #'PICT', -(sp) ; PICT
pea Offset
_GetScrap
tst.l (sp)+ ; byte count or OS ErrCode
bmi @8 ; Beep No Data of Type in Scrap
move.l a2, -(sp) ; Handle to PICTure ( used in 3rd call )
move.l a2, a6 ; save the Handle
move.l (a2), a2 ; Ptr to PICT Resource
lea 2(a2), a2 ; Ptr to PicFrame
lea Scratch8, a3
move.l (a2)+, (a3)+ ; A4 = PicFrame.TopLeft
move.l (a2), (a3) ; .BottomRight
lea Scratch20, a4
lea WStorage, a2
move.l portRect+Left(a2), d3 ; pRect.LeftBottom
add.l #$000AFFF6, d3 ; move PICT Org over ( 10, -10 )
move.l d3, (a4)
move.l -2(a3), -(sp) ; PicFrame.Left
pea (a4) ; pRect.LeftBottom = destPoint
_SubPt
move.l (a4), d0
swap d0
move.l d0, (a4)
pea Scratch8
move.l (a4), -(sp)
_OffsetRect
pea WStorage+portRect ; erase any old PICTs
_EraseRect
pea -4(a3) ; destRect = picFrame rectangle
_DrawPicture
move.l a6, -(sp) ; free up some space in the heap
_KillPicture
tst.b Have_Pasted(a5) ; reset to our Cursor if 1st time
bne.s @9 ; not 1st time
st Have_Pasted(a5)
bra @9
@8 move #2, -(sp) ; Beep if couldn't Paste
_SysBeep
@9 BRA UnHiLite
ErrReturn
_Debugger
Offset dc.l 0 ; used if we need most 'important'
; version of Type
GetFirstPixel
; user points w/mouse to a point just to the left of any
; left-edged pixel ( no 6-Neighbor ) in the region to be traversed.
; Program then scans left to right to find the apt byte and BitNum.
; < Where > is global coords of point to left of ON pixel in Rgn
; now calculate byte offset to first pixel in block from
; global address
pea Where
_GlobalToLocal
lea WStorage, a1 ; set up Right Bounds to check
move portRect+Right(a1), d3 ; against ( else we erase the
sub #4, d3 ; Window Frame )
; and leave a little leeway
@CheckNextPixel
move.l Where, -(sp)
_MoveTo
clr.b -(sp)
move.l Where, -(sp)
_GetPixel
tst.b (sp)+
bne.s @2 ; we found one !
lea Where, a0
add #1, 2(a0) ; move horizontally 1
cmp 2(a0), d3 ; have we passed the right edge ?
bpl.s @CheckNextPixel ; no
@1 _ShowCursor ; yes - we got problems
move #102, d3 ; StrID for upcoming Alert
BSR Stop_Alert ; 'Can't locate first point'
RTS
@2 move.l Where, StartCoords(a5)
; save the local Where for an _OpenRgn
; _MoveTo command & for closing the loop
pea Where ; now that we've found the local coords of
_LocalToGlobal ; our first pixel, convert that to an
move.l Where, d0 ; absolute memory reference ( Addr + BitNum )
; get byte addr ( a1 ) and bitNum of point ( d1 )
swap d0 ; y in Low Word
move d0, d1
mulu #64, d1 ; number of bytes down
swap d0 ; x back in Low Word
and.l #$0000FFFF, d0 ; zero Hi Word
divu #8, d0 ; number of bytes over
add d0, d1
add.l ScreenBase, d1
move.l d1, A3 ; = < Addr of StartPt >
swap d0 ; get back remainder in pixels
and.l #$0000FFFF, d0 ; zero quotient
sub.b #7, d0
neg d0
and.l #7, d0
move d0, D3 ; = < BitNum of StartPt >
move #-1, d0 ; Neg Flag = Found One
RTS
Stop_Alert ; an Alert of some sort is coming up
; the ID of the String DITL is in D3
move.l #'ALRT', a3
BSR Param_Text
move #101, d3 ; ResID for all StopAlerts
BSR Save_Image
_InitCursor ; reset to the standard northwest arrow
clr -(sp)
move d3, -(sp) ; AlertID
move.l #0, -(sp)
_StopAlert
move (sp)+, d0
BSR Restore_Image
RTS
Param_Text
clr.l -(sp)
move d3, -(sp)
_GetString
move.l (sp)+, a0
move.l (a0), -(sp) ; ^0
move.l #0, -(sp) ; ^1
move.l #0, -(sp) ; ^2
move.l #0, -(sp) ; ^3
_ParamText
RTS
OpenWindow
clr.l -(sp) ; for returned WindowPtr
move #WindID, -(sp) ; WindowID
pea WStorage ; storage for Window Record
move.l #-1, -(sp) ; in front
_GetNewWindow
_SetPort
lea WStorage, a0
pea portRect(a0) ; push the addr of portRect
_ClipRect
RTS
Save_WMgrPort
move.l (a5), a0
move.l (a0), a0 ; thePort
lea WMgrPort, a1
move.l a0, (a1)
move ScreenBits+rowBytes(a0), MyRowBytes(a5)
RTS
Install_Menus
clr.l -(sp)
move #AppleMenu, -(sp)
_GetRMenu ; resNum of DeskAcc Menu
move.l (sp), HAppleMenu(a5) ; save MenuHandle for later
move.l (sp), -(sp) ; push copy for _AddResMenu
clr -(sp) ; append to end
_InsertMenu
move.l #'DRVR', -(sp)
_AddResMenu
clr.l -(sp) ; Note: would have been a bit more
move #FileRgnMenu, -(sp) ; elegant to store these handles
_GetRMenu ; in an array rather than separate
move.l (sp), FileMenu(a5) ; variables. Oh well, if it works ...
clr -(sp)
_InsertMenu
clr.l -(sp)
move #EditRgnMenu, -(sp)
_GetRMenu
move.l (sp), EditMenu(a5)
clr -(sp)
_InsertMenu
clr.l -(sp)
move #CreateRgnMenu, -(sp)
_GetRMenu
move.l (sp), CreateMenu(a5)
clr -(sp)
_InsertMenu
clr.l -(sp)
move #DisplayRgnMenu, -(sp)
_GetRMenu
move.l (sp), DisplayMenu(a5)
clr -(sp)
_InsertMenu
_DrawMenuBar
move.l CreateMenu(A5), -(sp)
move #BuildRgnItem, -(sp) ; check it
st -(sp)
_CheckItem
RTS
InitManagers
pea -4(a5)
_InitGraf
_InitFonts
_InitWindows
_InitMenus
clr.l -(sp)
_InitDialogs
_TEInit
_InitCursor
move.l #$FFFF0000, d0
_FlushEvents
RTS
; CONSTANTS ( PC-rel addressing ) ----------------------------------
EventRecord
What: dc.w 0
Message: dc.l 0
When: dc.l 0
Where: dc.l 0
Modifiers: dc.w 0
PenPoint dc.l 0 ; start of Rgn Size Display
MouseLoc dc.l 0 ; for _PtInRect cursor check
ScratchSTR dcb.b 10, 0
WStorage dcb.b 156, 0
DACName dcb.b 40, 0
WhichWindow dc.l 0
WMgrPort dc.l 0
boundsRect dc.w 45, 10, 335, 500
StandardProcs dcb.l 13, 0
; VARs ( ref'd off A5 ) ------------------------------------------
Trav_Count ds 1
Default_Vol ds 1 ; VolRefNum of Default Volume
CurResFile ds 1 ; RefNum of Current Res File
MyRowBytes ds.l 1 ; used in Traverse.ASM / copy of rowBytes
RgnHandle ds.l 1
StartCoords ds.l 1
Image_Handle ds.l 1 ; Handle to saved Bit Image
HAppleMenu ds.l 1 ; handles for menus
FileMenu ds.l 1
EditMenu ds.l 1
CreateMenu ds.l 1
DisplayMenu ds.l 1
BitMap ds.b 14
DeskAcc_Opened ds.b 1 ; User has opened the ScrapBook DeskAcc
First_Activate ds.b 1 ; for Pasting from the Scrap on 1st Activate
Have_Pasted ds.b 1 ; have done a Paste
DoneFlag ds.b 1 ; GoAwayBox Click or File Menu 'Quit'
FormingRgn ds.b 1 ; Build / Don't Build a Region during Traverse
IsRegion ds.b 1 ; we've done a Traverse w/ 'Form Region' On
DoneCopyRegion ds.b 1 ; we've done a 'Copy Region' to the Work Area
END